/*
题目描述
Jessi初学英语，为了快速读出一串数字，编写程序将数字转换成英文：

如22：twenty two，123：one hundred and twenty three。

说明：

数字为正整数，长度不超过九位，不考虑小数，转化结果为英文小写；
输出格式为twenty two；
非法数据请返回“error”；
关键字提示：and，billion，million，thousand，hundred。

本题含有多组输入数据。

输入描述:
输入一个long型整数

输出描述:
输出相应的英文写法


示例1
输入
2356
输出
two thousand three hundred and fifty six
*/


//比较麻烦 先不看

#include <iostream>
#include <string>

using namespace std;

const string ones[] = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
const string tens[] = { "ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nighteen" };
const string twenties[] = { "zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety" };
const int ihundreds[] = { (int)1e2, (int)1e3, (int)1e6, (int)1e9, (int)1e12 };
const string hundreds[] = { "hundred", "thousand", "million", "billion" };

string itoe(long long n)
{
    if (0<=n && n<=9) return ones[n];
    if (10<=n && n<20) return tens[n%10];
    if (20<=n && n<1e2) return twenties[n/10] + (n%10 ? " " + ones[n%10] : "");
    for (int i=0; i < 5-1; i++) if (n < ihundreds[i+1]) {
        return itoe(n/ihundreds[i]) + " " + hundreds[i] + (n%ihundreds[i] ? (i ? " ": " and ") + itoe(n%ihundreds[i]) : "");
    }
    return "";  // ... ...
}

int main()
{
    for (long long N; cin>>N; ) cout<<itoe(N)<<endl;
    return 0;
}

	

